package org.ansel.webnodb.demo.controller;

import java.util.Map;

import org.ansel.webnodb.demo.service.IpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class IpController {
	@Autowired
	private IpService service;
	
	@RequestMapping("/myip")
	public String myip(Model m) {
		String ip = service.getPublicIp();
		m.addAttribute("IP", ip);
		return "myip";
	}
	@RequestMapping("/myip2")
	public String myip2(Map<String,Object> map) {
		String ip = service.getPublicIp();
		map.put("IP", ip);
		return "myip";
	}
}
